package com.dmall.dao;

import com.dmall.domain.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CustomerDao extends JpaRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {

    @Query("update Customer set custName = ?2 where custId = ?1")
    @Modifying
    void updateCustNameById(Long id, String custName);

    Customer findByCustName(String custName);

    List<Customer> findByCustNameLike(String custName);

    List<Customer> findByCustNameContaining(String custName);
}
